home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Simple_Bil206355522007.psc / FileProtection Pro / CResize.cls < prev    next >
Text File  |  2007-04-21  |  3KB  |  109 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "CResize"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14.  
  15. Option Explicit
  16.  
  17. Enum eParams
  18.     RS_TopOnly = 1
  19.     RS_LeftOnly = 2
  20.     RS_Top_Left = 3
  21.     RS_HeightOnly = 4
  22.     RS_WidthOnly = 5
  23.     RS_Height_Width = 6
  24. End Enum
  25. Private Type cInfo
  26.     cControl As Control
  27.     cHeight As Integer
  28.     cWidth As Integer
  29.     cTop As Integer
  30.     cLeft As Integer
  31.     cInfo As Integer
  32. End Type
  33.  
  34. Private cArray() As cInfo
  35. Private Count As Integer
  36.  
  37. Private FormHeight As Integer
  38. Private FormWidth As Integer
  39.  
  40. Public Property Let hParam(ByVal fh As Integer)
  41.     FormHeight = fh
  42.         
  43. End Property
  44. Public Property Let wParam(ByVal fw As Integer)
  45.     FormWidth = fw
  46. End Property
  47. Public Sub Map(rCont As Control, SizeInfo As eParams)
  48.     Count = Count + 1
  49.     ReDim Preserve cArray(Count)
  50.     Set cArray(Count).cControl = rCont
  51.     cArray(Count).cInfo = SizeInfo
  52.     
  53.     Select Case SizeInfo
  54.         Case 1:
  55.             cArray(Count).cTop = FormHeight - rCont.Top
  56.         Case 2:
  57.             cArray(Count).cLeft = FormWidth - rCont.Left
  58.         Case 3:
  59.             cArray(Count).cTop = FormHeight - rCont.Top
  60.             cArray(Count).cLeft = FormWidth - rCont.Left
  61.         Case 4:
  62.             cArray(Count).cHeight = FormHeight - rCont.Height
  63.         Case 5:
  64.             cArray(Count).cWidth = FormWidth - rCont.Width
  65.         Case 6:
  66.             cArray(Count).cHeight = FormHeight - rCont.Height
  67.             cArray(Count).cWidth = FormWidth - rCont.Width
  68.         Case Else:
  69.             Exit Sub
  70.     End Select
  71.     
  72. End Sub
  73.  
  74. Public Sub rSize(cForm As Form)
  75.     
  76.     On Error Resume Next
  77.     Dim i As Integer, a As Integer, b As Integer
  78.     For i = 1 To Count
  79.         Select Case cArray(i).cInfo
  80.             Case 1:
  81.                 cArray(i).cControl.Top = cForm.Height - cArray(i).cTop
  82.             Case 2:
  83.                 cArray(i).cControl.Left = cForm.Width - cArray(i).cLeft
  84.             Case 3:
  85.                 cArray(i).cControl.Top = cForm.Height - cArray(i).cTop
  86.                 cArray(i).cControl.Left = cForm.Width - cArray(i).cLeft
  87.             Case 4:
  88.                 b = cForm.Height - cArray(i).cHeight
  89.                 If b < 0 Then b = 0
  90.                 cArray(i).cControl.Height = b 'cForm.Height - cArray(i).cHeight
  91.             Case 5:
  92.                 a = cForm.Width - cArray(i).cWidth
  93.                 If a < 0 Then a = 0
  94.                 cArray(i).cControl.Width = a 'cForm.Width - cArray(i).cWidth
  95.             Case 6:
  96.                 a = cForm.Width - cArray(i).cWidth
  97.                 b = cForm.Height - cArray(i).cHeight
  98.                 If a < 0 Then a = 0
  99.                 If b < 0 Then b = 0
  100.                 cArray(i).cControl.Height = b 'cForm.Height - cArray(i).cHeight
  101.                 cArray(i).cControl.Width = a 'cForm.Width - cArray(i).cWidth
  102.             
  103.                 
  104.         End Select
  105.     Next
  106.  
  107. End Sub
  108.  
  109.